home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / AXON / SQUARE.C < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.1 KB  |  43 lines

  1. // Dynamic link library implementation of squareing axon
  2.  
  3. #include "NSDLL.h" 
  4.  
  5. /************************************************/
  6. /* Macro to access the PE layer in matrix form */
  7.  
  8. #define data(i,j)        data[j+i*cols]
  9.  
  10. /***********************************/
  11. /* Forward activation of component */
  12.  
  13. __declspec(dllexport) void performAxon(
  14.     DLLData    *instance,    // Pointer to instance data (may be NULL)
  15.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  16.     int     rows,        // Number of rows of PEs in the layer
  17.     int     cols        // Number of columns of PEs in the layer
  18.     )
  19. {
  20.     int i, length=rows*cols; 
  21.  
  22.     for (i=0; i<length; i++)
  23.         data[i] *= data[i];
  24. }
  25.  
  26. /******************************************/
  27. /* Management of instance data (OPTIONAL) */
  28. /*
  29. __declspec(dllexport) DLLData *allocAxon(
  30.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  31.     int     rows,        // Number of rows of PEs in the layer
  32.     int     cols        // Number of columns of PEs in the layer
  33.     )
  34. {
  35.     DLLData *instance = allocDLLInstance(oldInstance);
  36.     return instance;
  37. }
  38.  
  39. __declspec(dllexport) void freeAxon(DLLData *instance)
  40. {
  41.     freeDLLInstance(instance);
  42. }
  43. */